<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JQ的循环</title>
  <script src="../js1/jquery-1.11.0.min.js"></script>
    <script>
        $(function () {
            /*遍历数组*/
            var arr =["北","上","广","深","杭"]
            //each(callback) ->全局函数
            $.each(arr,function (i,n){
                console.log(i);  //参数i 表示循环的下标值
                console.log(n);  //参数n 表示当前下标所对应的元素值
                console.log(this);
            });

            /*遍历标签*/
            $("div").each(function (i) {
                console.log(i);   //参数i 表示循环的下标值
                console.log(this);  //this表示 每一个元素，属于JS对象
            })
        });
    </script>
</head>
<body>
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
</body>
</html>